{% extends "base.html" %}
{% load bootstrap3 %}
{% block title %}{% if title %}{{ title }}{% else %}小时数据{% endif %}{% endblock %}

{% block head_script_block %}
<script src="/js/show_rawdata_realtime.js"></script>
<!--
<script type="text/javascript" language="javascript" class="init">

    $(document).ready(function() {
        $( "#hour_datas" ).dataTable(
                {
                    "sDom": 'T<"clear">lfrtip',
                    "tableTools": {
                        "aButtons": [
                            {
                                "sExtends": "csv",
                                "oSelectorOpts": {
                                    page: 'all'
                                },
                                "sButtonText": "导出CSV"
                            },
                            {
                                "sExtends": "xls",
                                "oSelectorOpts": {
                                    page: 'all'
                                },
                                "sButtonText": "导出EXCEL"
                            }
                        ]
                    },
                    "oLanguage":{//汉化
                        "sLengthMenu":"显示 _MENU_ 条记录",
                        "sZeroRecords":"没有检索到数据",
                        "sInfo":"当前数据为从 _START_ to _END_ 条数据；总共有 _TOTAL_ 条记录",
                        "sInfoEmpty":"没有数据",
                        "sProcessing":"正在加载数据......",
                        "sSearch":"查询",
                        "sInfoFiltered": "(过滤自 _MAX_ 条记录)",
                        "oPaginate":{
                            "sFirst":"首页",
                            "sPrevious":"前页",
                            "sNext":"后页",
                            "sLast":"尾页"
                        }
                    }
                });
    } );
</script>
-->
{% endblock %}
{% block body_content_block %}
<div class="row-fluid">
    <div class="span4">
        <legend>门店筛选{% if gdatas %}(命中{{ gdatas|length }}门店){% endif %}</legend>
        <form  action="./" method="post">{% csrf_token %}
            {% bootstrap_form form layout='horizontal' %}

            <input class='btn btn-primary' id='button' type='submit' value='导出'/>
        </form>
    </div>
    <div class="span8">
        {% if hourFields %}
            <table class="table table-bordered" id="hour_datas">
                <thead>
                <tr>
                    {% for field in hourFields %}
                    <th>{{ field }}</th>
                    {% endfor %}
                </tr>
                </thead>
                <tbody id="hour_datas_body">

                </tbody>
            </table>
        {% endif  %}
    </div>
</div>

<script>
    $(document).ready(function() {

        var hourDatas="{{ hourDatas }}"
        hourDatas = eval("(" + hourDatas.replace(/&quot;/g,"'") + ")");
        $('#hour_datas').dataTable( {

            "data": hourDatas,
            "language":{
                'url':'/js/dataTables.language.chinese.json'
            },
            "sDom": 'T<"clear">lfrtip',
            "tableTools": {
                "aButtons": [
                    {
                        "sExtends": "csv",
                        "oSelectorOpts": {
                            page: 'all'
                        },
                        "sButtonText": "导出CSV"

                    },
                    {
                        "sExtends": "xls",
                        "oSelectorOpts": {
                            page: 'all'
                        },
                        "sButtonText": "导出EXCEL"
                    }
                ]

            }

        } );
    } );


    $('#id_startTime').datetimepicker({format: 'yyyy-mm-dd',
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0});
    $( ".target" ).change(function() {
        $("#button").click()
    });
    $('#id_endTime').datetimepicker({format: 'yyyy-mm-dd',
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0});


</script>

{% endblock %}
